<tagLib name="wego" />
<include file="public:header" />
<script type="text/javascript" src="__ROOT__/statics/js/jquery/plugins/jquery.imagePreview.js"></script>
<div class="pad-10" >
    <form id="myform" name="myform" action="{:u('guide/delete')}" method="post" onsubmit="return check();">
    <div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
                <th width="50">ID</th>
                <th width=15><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>                
                <th width="40">&nbsp;</th>
                <th>标题</th>
                <th width=60>所属商品分类</th>
                <th width=60>所属商城</th>
                <th width=90>发布时间</th>
		<th width=40>结束时间</th>
                <th width=30>排序</th>
                <th width=40>状态</th>
                <th width="30">是否热门</th>			
                <th width=30>是否推荐</th>
                <th width=30>操作</th>
            </tr>
        </thead>
    	<tbody>
        <volist name="guide_list" id="val" >
        <tr>
            <td align="center">{$val.gid}</td>
            <td align="center"><input type="checkbox" value="{$val.gid}" name="id[]"></td>           
            <td align="right"><img width="75" height="75" src="__ROOT__/data/guide/{$val.image}"/></td>
            <td align="left"><a href="{:u('guide/edit', array('id'=>$val['gid']))}">{$val.title}</a></td>
            <td align="center"><b>{$cate_list[$val['catid']]['name']}</b></td>
            <td align="center">{$seller_list[$val['sellerid']]['name']}</td>
            <td align="center">{$val.createtime|date="Y-m-d H:i:s",###}</td>
            <td align="center">{$val.endtime|date="Y-m-d H:i:s",###}</td>
            <td align="center">{$val.listorder}</td>
            <td align="center" onclick="status({$val.gid},'status')" id="status_{$val.gid}"><img src="__ROOT__/statics/images/status_{$val.status}.gif" /></td>
            <td align="center" onclick="status({$val.gid},'ishot')" id="ishot_{$val.gid}"><img src="__ROOT__/statics/images/status_{$val.ishot}.gif" /></td>
            <td align="center" onclick="status({$val.gid},'isbest')" id="isbest_{$val.gid}"><img src="__ROOT__/statics/images/status_{$val.isbest}.gif" /></td>
            <td align="center"><a class="blue" href="{:u('guide/edit',array('id'=>$val['gid']))}">编辑</a></td>
        </volist>
    	</tbody>
    </table>

    <div class="btn">
    	<label for="check_box" style="float:left;">全选/取消</label>
    	<input type="submit" class="button" name="dosubmit" value="{$Think.lang.delete}" onclick="return confirm('{$Think.lang.sure_delete}')" style="float:left;margin:0 10px 0 10px;"/>
        
    	<div id="pages">{$page}</div>
    </div>

    </div>
    </form>
</div>
<script language="javascript">
$(function(){
	$(".preview").preview();
});

var lang_cate_name = "名称";
function check(){
	if($("#myform").attr('action') == '{:u("guide/delete")}') {
		var ids='';
		$("input[name='id[]']:checked").each(function(i, n){
			ids += $(n).val() + ',';
		});

		if(ids=='') {
			window.top.art.dialog({content:lang_please_select+lang_cate_name,lock:true,width:'200',height:'50',time:1.5},function(){});
			return false;
		}
	}
	return true;
}
function status(id,type){
    $.get("{:u('guide/status')}", { id: id, type: type }, function(jsondata){
		var return_data  = eval("("+jsondata+")");
		$("#"+type+"_"+id+" img").attr('src', '__ROOT__/statics/images/status_'+return_data.data+'.gif')
	}); 
}
////排序方法
//function sort(id,type,num){
//    
//    $.get("{:u('items/sort')}", { id: id, type: type,num:num }, function(jsondata){
//        
//		$("#"+type+"_"+id+" ").attr('value', jsondata.data);
//	},'json'); 
//}
</script>
</body>
</html>
